//===============================================================================
// Microsoft patterns & practices
// Web Client Software Factory
//-------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//-------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System;
using System.Collections.Generic;

namespace WCSFContrib.PageFlow
{
	/// <summary>
	/// A catalog of <see cref="IPageFlowDefinition"/>s.
	/// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
    public class PageFlowDefinitionCatalog : List<IPageFlowDefinition>, IPageFlowDefinitionCatalog
	{
		/// <summary>
		/// Removes an <see cref="IPageFlowDefinition"/> from the catalog.
		/// </summary>
		/// <param name="definition">The definition to remove.</param>
		public new void Remove(IPageFlowDefinition definition)
		{
			base.Remove(definition);
		}

		/// <summary>
		/// Get an <see cref="IPageFlowDefinition"/> with a specific URL from the catalog.
		/// </summary>
		/// <param name="rawUrl">The URL to search for.</param>
		/// <returns>The <see cref="IPageFlowDefinition"/> with a matching URL.</returns>
		public IPageFlowDefinition GetByUrl(string rawUrl)
		{
			return Find(new Predicate<IPageFlowDefinition>(delegate(IPageFlowDefinition definition)
			                                               	{
			                                               		return definition.ContainsUrl(rawUrl);
			                                               	}
			            	)
				);
		}
	}
}
